import request from '@/utils/request'

// 搜索售货机列表 managers  可用于 state
export const getVmSearchManager = params => request.get('/api/vm-service/vm/search', {
  params
})

// 点位搜索
export const getVmNodeSearch = data => request.get('/api/vm-service/node/search', { params: { ...data } })

// 新增售货机
export const addVmTypeManager = data => request.post('/api/vm-service/vm', data)

// 售货机类型搜索
export const getVmTypeSearch = data => request.get('/api/vm-service/vmType/search', { params: { ...data } })

// 修改售货机点位
export const ChangeVmTypeNode = data => request.put(`/api/vm-service/vm/${data.id}/${data.nodeId}`)

// 获取售货机策略
export const getVmPolicy = innerCode => request.get(`/api/vm-service/policy/vmPolicy/${innerCode}`)

// 2.  获取一定范围内的订单总数
export const getTypeOrderCount = params => request.get('/api/order-service/report/orderCount', {
  params
})
// 获取一定时间范围内的收入
export const getTypeOrderAmount = params => request.get('/api/order-service/report/orderAmount', { params })

// 获取售货机的补货次数
export const getTypeSupplyCount = data => request.get(`/api/task-service/task/supplyCount/${data.innerCode}/${data.start}/${data.end}`)

// 获取售货机的维修次数
export const getTypeRequirCount = params => request.get(`/api/task-service/task/repairCount/${params.innerCode}/${params.start}/${params.end}`)

// 获取售货机的商品销量
export const getTypeSkucollect = data => request.get(`/api/order-service/report/skuCollect/${data.innerCode}/${data.start}/${data.end}`)

// 图片上传
export const updataImg = data => request.post('/api/vm-service/sku/fileUpload', data)

// 新增售货机类型
export const addVmType = data => request.post('/api/vm-service/vmType', data)

// 获取售货机详情
export const getVmTypeDetial = typeId => request.get(`/api/vm-service/vmType/${typeId}`)

// 修改售货机详情
export const ChangeVmTypeDetial = data => request({
  url: `/api/vm-service/vmType/${data.typeId}`,
  method: 'PUT',
  data
})

// 删除售货机
export const delVmType = typeId => request.delete(`/api/vm-service/vmType/${typeId}`)
